home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / inc / x11 / extensio / multibuf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  11.4 KB  |  324 lines

  1. /*
  2.  * $XConsortium: multibuf.h,v 1.12 89/11/01 09:09:56 jim Exp $
  3.  *
  4.  * Copyright 1989 Massachusetts Institute of Technology
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and its
  7.  * documentation for any purpose is hereby granted without fee, provided that
  8.  * the above copyright notice appear in all copies and that both that
  9.  * copyright notice and this permission notice appear in supporting
  10.  * documentation, and that the name of M.I.T. not be used in advertising or
  11.  * publicity pertaining to distribution of the software without specific,
  12.  * written prior permission.  M.I.T. makes no representations about the
  13.  * suitability of this software for any purpose.  It is provided "as is"
  14.  * without express or implied warranty.
  15.  *
  16.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  17.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  18.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  20.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  21.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22.  */
  23.  
  24. #ifndef _MULTIBUF_H_
  25. #define _MULTIBUF_H_
  26.  
  27. #define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
  28.  
  29. #define MULTIBUFFER_MAJOR_VERSION    1    /* current version numbers */
  30. #define MULTIBUFFER_MINOR_VERSION    0
  31.  
  32. #define X_MbufGetBufferVersion        0
  33. #define X_MbufCreateImageBuffers    1
  34. #define X_MbufDestroyImageBuffers    2
  35. #define X_MbufDisplayImageBuffers    3
  36. #define X_MbufSetMultiBufferAttributes    4
  37. #define X_MbufGetMultiBufferAttrib    5 /* Shortened from Attributes. POHC 90/01/15 */
  38. #define X_MbufSetBufferAttributes    6
  39. #define X_MbufGetBufferAttributes    7
  40. #define X_MbufGetBufferInfo        8
  41. #define X_MbufCreateStereoWindow    9
  42.  
  43. /*
  44.  * update_action field
  45.  */
  46. #define MultibufferUpdateActionUndefined    0
  47. #define MultibufferUpdateActionBackground    1
  48. #define MultibufferUpdateActionUntouched    2
  49. #define MultibufferUpdateActionCopied        3
  50.  
  51. /*
  52.  * update_hint field
  53.  */
  54. #define MultibufferUpdateHintFrequent        0
  55. #define MultibufferUpdateHintIntermittent    1
  56. #define MultibufferUpdateHintStatic        2
  57.  
  58. /*
  59.  * valuemask fields
  60.  */
  61. #define MultibufferWindowUpdateHint    (1L << 0)
  62. #define MultibufferBufferEventMask    (1L << 0)
  63.  
  64. /*
  65.  * mono vs. stereo and left vs. right
  66.  */
  67. #define MultibufferModeMono        0
  68. #define MultibufferModeStereo        1
  69. #define MultibufferSideMono        0
  70. #define MultibufferSideLeft          1
  71. #define MultibufferSideRight        2
  72.  
  73. /*
  74.  * clobber state
  75.  */
  76. #define MultibufferUnclobbered        0
  77. #define MultibufferPartiallyClobbered    1
  78. #define MultibufferFullyClobbered    2
  79.  
  80. /*
  81.  * event stuff
  82.  */
  83. #define MultibufferClobberNotifyMask    0x02000000
  84. #define MultibufferUpdateNotifyMask    0x04000000
  85.  
  86. #define MultibufferClobberNotify    0
  87. #define MultibufferUpdateNotify        1
  88. #define MultibufferNumberEvents        (MultibufferUpdateNotify + 1)
  89.  
  90. #define MultibufferBadBuffer        0
  91. #define MultibufferNumberErrors        (MultibufferBadBuffer + 1)
  92.  
  93.  
  94. #ifndef _MULTIBUF_SERVER_
  95. /*
  96.  * Extra definitions that will only be needed in the client
  97.  */
  98. typedef XID Multibuffer;
  99.  
  100. typedef struct _XmbufClobberNotifyEvent { /* POHC 92/02/14 */
  101.     int    type;            /* of event */
  102.     unsigned long serial;   /* # of last request processed by server */
  103.     int send_event;        /* true if this came frome a SendEvent request */
  104.     Display *display;        /* Display the event was read from */
  105.     Multibuffer buffer;        /* buffer of event */
  106.     int    state;            /* see Clobbered constants above */
  107. } XmbufClobberNotifyEvent;
  108.  
  109. typedef struct _XmbufUpdateNotifyEvent { /* POHC 92/02/14 */
  110.     int    type;            /* of event */
  111.     unsigned long serial;   /* # of last request processed by server */
  112.     int send_event;        /* true if this came frome a SendEvent request */
  113.     Display *display;        /* Display the event was read from */
  114.     Multibuffer buffer;        /* buffer of event */
  115. } XmbufUpdateNotifyEvent;
  116.  
  117.  
  118. /*
  119.  * per-window attributes that can be got
  120.  */
  121. typedef struct _XmbufWindowAttributes { /* POHC 92/02/14 */
  122.     int displayed_index;    /* which buffer is being displayed */
  123.     int update_action;        /* Undefined, Background, Untouched, Copied */
  124.     int update_hint;        /* Frequent, Intermittent, Static */
  125.     int window_mode;        /* Mono, Stereo */
  126. } XmbufWindowAttributes;
  127.  
  128. /*
  129.  * per-window attributes that can be set
  130.  */
  131. typedef struct _XmbufSetWindowAttributes { /* POHC 92/02/14 */
  132.     int update_hint;        /* Frequent, Intermittent, Static */
  133. } XmbufSetWindowAttributes;
  134.  
  135.  
  136. /*
  137.  * per-buffer attributes that can be got
  138.  */
  139. typedef struct _XmbufBufferAttributes { /* POHC 92/02/14 */
  140.     Window window;        /* which window this belongs to */
  141.     unsigned long event_mask;    /* events that have been selected */
  142.     int buffer_index;        /* which buffer is this */
  143.     int side;            /* Mono, Left, Right */
  144. } XmbufBufferAttributes;
  145.  
  146. /*
  147.  * per-buffer attributes that can be set
  148.  */
  149. typedef struct _XmbufSetBufferAttributes { /* POHC 92/02/14 */
  150.     unsigned long event_mask;    /* events that have been selected */
  151. } XmbufSetBufferAttributes;
  152.  
  153.  
  154. /*
  155.  * per-screen buffer info (there will be lists of them)
  156.  */
  157. typedef struct _XmbufBufferInfo { /* POHC 92/02/14 */
  158.     VisualID visualid;        /* visual usuable at this depth */
  159.     int max_buffers;        /* most buffers for this visual */
  160.     int depth;            /* depth of buffers to be created */
  161. } XmbufBufferInfo;
  162.  
  163.  
  164. /*
  165.  * The application programming library contains the interfaces described below.
  166.  * With the exception of XmbufQueryExtension, if any of these routines are
  167.  * called with a display that does not support the extension, the
  168.  * ExtensionErrorHandler (which can be set with XSetExtensionErrorHandler and
  169.  * functions the same way as XSetErrorHandler) will be called.
  170.  *
  171.  
  172. Bool XmbufQueryExtension (dpy, event_base_return, error_base_return)
  173.     Display *dpy;
  174.     int *event_base_return, *error_base_return;
  175.  
  176.     Returns True if the multibuffering/stereo extension is available on the
  177.     given display.  If the extension exists, the value of the first event
  178.     code (which should be added to the event type constants
  179.     MultibufferClobberNotify and MultibufferUpdateNotify to get the actual
  180.     values) is stored into event_base_return and the value of the first
  181.     error code (which should be added to the error type constant
  182.     MultibufferBadBuffer to get the actual value) is stored into
  183.     error_base_return.
  184.  
  185.  
  186. Status XmbufGetVersion (dpy, major_version_return, minor_version_return)
  187.     Display *dpy;
  188.     int *major_version_return, *minor_version_return;
  189.  
  190.     Gets the major and minor version numbers of the extension.  The return
  191.     value is zero if an error occurs or non-zero if no error happens.
  192.  
  193.  
  194. int XmbufCreateBuffers (dpy, window, count, update_action, update_hint,
  195.             buffers_update)
  196.     Display *dpy;
  197.     Window window;
  198.     int count;
  199.     int update_action, update_hint;
  200.     Multibuffer *buffers_update;
  201.  
  202.     Requests that "count" buffers be created with the given update_action
  203.     and update_hint and be associated with the indicated window.  The
  204.     number of buffers created is returned (zero if an error occurred)
  205.     and buffers_update is filled in with that many Multibuffer identifiers.
  206.  
  207.  
  208. void XmbufDestroyBuffers (dpy, window)
  209.     Display *dpy;
  210.     Window window;
  211.  
  212.     Destroys the buffers associated with the given window.
  213.  
  214.  
  215. void XmbufDisplayBuffers (dpy, count, buffers, min_delay, max_delay)
  216.     Display *dpy;
  217.     int count;
  218.     Multibuffer *buffers;
  219.     int min_delay, max_delay;
  220.  
  221.     Displays the indicated buffers their appropriate windows within
  222.     max_delay milliseconds after min_delay milliseconds have passed.
  223.     No two buffers may be associated with the same window or else a Matc
  224.     error is generated.
  225.  
  226.  
  227. Status XmbufGetWindowAttributes (dpy, window, attributes)
  228.     Display *dpy;
  229.     Window window;
  230.     XmbufWindowAttributes *attributes;
  231.  
  232.     Gets the multibuffering attributes that apply to all buffers associated
  233.     with the given window.  Returns non-zero on success and zero if an
  234.     error occurs.
  235.  
  236.  
  237. void XmbufChangeWindowAttributes (dpy, window, valuemask, attributes)
  238.     Display *dpy;
  239.     Window window;
  240.     unsigned long valuemask;
  241.     XmbufSetWindowAttributes *attributes;
  242.  
  243.     Sets the multibuffering attributes that apply to all buffers associated
  244.     with the given window.  This is currently limited to the update_hint.
  245.  
  246.  
  247. Status XmbufGetBufferAttributes (dpy, buffer, attributes)
  248.     Display *dpy;
  249.     Buffer buffer;
  250.     XmbufBufferAttributes *attributes;
  251.  
  252.     Gets the attributes for the indicated buffer.  Returns non-zero on
  253.     success and zero if an error occurs.
  254.  
  255.  
  256. void XmbufChangeBufferAttributes (dpy, buffer, valuemask, attributes)
  257.     Display *dpy;
  258.     Multibuffer buffer;
  259.     unsigned long valuemask;
  260.     XmbufSetBufferAttributes *attributes;
  261.  
  262.     Sets the attributes for the indicated buffer.  This is currently
  263.     limited to the event_mask.
  264.  
  265.  
  266. Status XmbufGetScreenInfo (dpy, drawable, nmono_return, mono_info_return,
  267.                nstereo, stereo_info_return)
  268.     Display *dpy;
  269.     Drawable drawable;
  270.     int *nmono_return;
  271.     XmbufBufferInfo **mono_info_return;
  272.     int *nstereo_return;
  273.     XmbufBufferInfo **stereo_info_return;
  274.  
  275.     Gets the parameters controlling how mono and stereo windows may be
  276.     created on the screen of the given drawable.  The numbers of sets of
  277.     visual and depths are returned in nmono_return and nstereo_return.  If
  278.     nmono_return is greater than zero, then mono_info_return is set to the
  279.     address of an array of XmbufBufferInfo structures describing the
  280.     various visuals and depths that may be used.  Otherwise,
  281.     mono_info_return is set to NULL.  Similarly, stereo_info_return is set
  282.     according to nstereo_return.  The storage returned in mono_info_return
  283.     and stereo_info_return may be released by XFree.  If no errors are
  284.     encounted, non-zero will be returned.
  285.  
  286.  
  287. Window XmbufCreateStereoWindow (dpy, parent, x, y, width, height, border_width,
  288.                 depth, class, visual, valuemask, attributes,
  289.                 left_return, right_return)
  290.     Display *dpy;
  291.     Window parent;
  292.     int x, y;
  293.     unsigned int width, height, border_width;
  294.     int depth;
  295.     unsigned int class;
  296.     Visual *visual;
  297.     unsigned long valuemask;
  298.     XSetWindowAttributes *attributes;
  299.     Multibuffer *left_return, *right_return;
  300.  
  301.     Creates a stereo window in the same way that XCreateWindow creates
  302.     a mono window.  The buffer ids for the left and right buffers are 
  303.     returned in left_return and right_return, respectively.  If an
  304.     extension error handler that returns is installed, None will be
  305.     returned if the extension is not available on this display.
  306.  
  307.  * 
  308.  */
  309.  
  310. extern Bool XmbufQueryExtension ();    /* is extension on server */
  311. extern Status XmbufGetVersion ();        /* what is extension rev */
  312. extern int XmbufCreateBuffers ();        /* create buffers for window */
  313. extern void XmbufDestroyBuffers ();    /* destroy buffers for window */
  314. extern void XmbufDisplayBuffers ();    /* make buffers current */
  315. extern Status XmbufGetWindowAttributes ();   /* get extension window attrs */
  316. extern void XmbufChangeWindowAttributes ();  /* set extension window attrs */
  317. extern Status XmbufGetBufferAttributes ();   /* get buffer attrs */
  318. extern void XmbufChangeBufferAttributes ();  /* set buffer attrs */
  319. extern Status XmbufGetScreenInfo ();    /* get mono and stereo parameters */
  320. extern Window XmbufCreateStereoWindow ();/* stereo version of XCreateWindow */
  321.  
  322. #endif /* _MULTIBUF_SERVER_ */
  323. #endif /* _MULTIBUF_H_ */
  324.